home *** CD-ROM | disk | FTP | other *** search
- Path: acsu.buffalo.edu!usenet
- From: nvp@acsu.buffalo.edu
- Newsgroups: comp.lang.c++
- Subject: Interpreting tokens in C++???
- Date: Wed, 14 Feb 1996 14:31:45 -0500
- Organization: SUNY@Buffalo
- Message-ID: <312238A1.4F70@cadman.cit.buffalo.edu>
- NNTP-Posting-Host: armstrong.cs.buffalo.edu
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- NNTP-Posting-User: nvp
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.4 sun4m)
-
- Hello, I am trying to write C++ code that considers a theoretical
- language (TLAN), and through two classes (and re-casting), interprets
- tokens from the TLAN to have meaning in C++.
-
- BTW, these programs are not being compiled (no error checking for now),
- but are interpreted by the code.
-
- Here's a sample TLAN program:
-
- BEGIN // ignored by interpreter.
- SET I 10 // i = 10
- SET V 1 // v = 1
- WHILE V
- BEGIN
- INC V // v++
- DEC I // i--
- PRINT V // cout << v
- NEWLINE // endl
- END
- END // program end
-
- I am presently using #define to define each token (using an integer)
- and strtok (from the c-library token.h).
-
- For a statement like SET I 10, how would I get token I to = token 10?
-
- Strtok breaks them up into tokens, but I am having problems with
- interpreting the meaning of statements after that ...
-
- Thank you
-
- Sincerely,
-
- Nathan V. Patwardhan
- nvp@cs.buffalo.edu
-